package com.usian.admin.controller;

import com.usian.admin.service.UserLoginService;
import com.usian.admin.service.impl.UserLoginServiceImpl;
import com.usian.apis.admin.LoginControllerApi;
import com.usian.model.admin.dtos.AdUserDto;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController implements LoginControllerApi {
    @Autowired
    private UserLoginService userLoginService;
    @Override
    @PostMapping("/in")
    public ResponseResult login(AdUserDto dto) {
        return userLoginService.login(dto);
    }

    @GetMapping("/temp")
    public String a() {
        return "hhhhhh";
    }
 /* public static void main(String[] args) {
        String salt = "123456";
        String pswd = "123456"+salt;

        String saltPswd = DigestUtils.md5DigestAsHex(pswd.getBytes());
        System.out.println(saltPswd);
    }*/
}
